//
//  TTSDiscoverDetailsViewController.m
//  TTSVideo
//
//  Created by Zhai on 16/2/29.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TTSDiscoverDetailsViewController.h"
#import "TTSCustomNavigation.h"

@interface TTSDiscoverDetailsViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>

@property (nonatomic,retain)UICollectionView *backCollectionView;
@property (nonatomic,retain)TTSCustomNavigation *titleNavigation;
@property (nonatomic,retain)NSMutableArray *titleArray;

@end

@implementation TTSDiscoverDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.title = self.title;
    
    UIImage *eyeImage = [UIImage imageNamed:@"iconfont-yanjing"];
    eyeImage = [eyeImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:eyeImage style:UIBarButtonItemStyleDone target:self action:@selector(eyeBarButtonAction:)];
    
    
    self.titleArray = [NSMutableArray arrayWithObjects:@"按时间排序", @"分享排行榜", nil];
    self.titleNavigation = [[TTSCustomNavigation alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 28) titleArray:self.titleArray titleColor:[UIColor blackColor] titleSelectedColor:[UIColor blackColor] lineColor:[UIColor grayColor] sizeOfFont:15.0];
    [self.view addSubview:self.titleNavigation];
    
    [self createCollection];
    
    
}

- (void)createCollection{
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.minimumInteritemSpacing = 0;
    flowLayout.minimumLineSpacing = 0;
    flowLayout.itemSize = CGSizeMake(WIDTH, HEIGHT - 64 - 36 - 28);
    self.backCollectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 28, WIDTH, HEIGHT - 64 - 36 - 28) collectionViewLayout:flowLayout];
    self.backCollectionView.delegate = self;
    self.backCollectionView.dataSource = self;
    [self.backCollectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"
     ];
    [self.view addSubview:self.backCollectionView];
    
}
//  实现colectionView 协议方法

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.titleArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor blueColor];
    return cell;
}

// 实现

- (void)eyeBarButtonAction:(UIBarButtonItem *)btn{
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
